package rs.etf.mips.crossroad.logic;

/**
 * The traffic space where the vehicles can move.
 * @author Momcilo
 *
 */
public interface ITrafficSpace extends Iterable<Vehicle>, ILogicElement {
	
	/**
	 * @param vehicle to move
	 * @return <b>true</b> if the vehicle is moved; otherwise, <b>false</b>.
	 */
	public boolean move(Vehicle vehicle);
	
	/**
	 * @param vehicle
	 * @return <b>true</b> if vehicle can move; otherwise, <b>false</b>.
	 */
	public boolean canMove(Vehicle vehicle);
	
	
	/**
	 * @param x x-coordinate in the traffic space
	 * @param y y-coordinate in the traffic space
	 * @return <b>true</b> if specified space is not occupied; otherwise, <b>false</b>.
	 */
	public boolean isFree(double x, double y);
	
	/**
	 * Adds vehicle in the traffic space.
     * @param vehicle - the vehicle to add in the traffic space.
     * @return <b>false</b> when the vehicle is not added; otherwise, <b>true</b>.
     */
	public boolean addVehicle(Vehicle vehicle);
	
	/**
	 * Adds vehicle in the traffic space.
     * @param vehicle - the vehicle to add in the traffic space.
     * @param neighbor - neighbor traffic space from which the vehicle came from.
     * @return <b>false</b> when the vehicle is not added; otherwise, <b>true</b>.
     */
	public boolean addVehicle(Vehicle vehicle, ITrafficSpace neighbor);
	
}
